import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout'

const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        name: '首页',
        component: () => import('@/views/index'),
      },
      {
        name: '用户授权',
        path: '/authorize',
        component: () => import('@/views/oauth2/authorize'),
        props: (route) => ({
          client_id: route.query.client_id,
          redirect_uri: route.query.redirect_uri,
          state: route.query.state,
        }),
      },
    ],
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router
